const request=new XMLHttpRequest()
request.onreadystatechange=function(e){
  if(request.readyState === 4){
    if(request.status>=200 && request.status<=300){
      console.log(request.responseText)
    }else if(request.status>=400){
      console.log("错误信息:"+request.status)
    }
  }
}

request.open('POST','http://xxx')
request.send();